package com.hzsai.pojo;

import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;

/**
 * hzsai 2019/7/25
 * usage:
 **/
public class Validatorpojo {

    @NotNull(message = "id不能为0")
    private long id;

    @NotNull
    @Future(message = "将来的日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date date;

    @NotNull
    @DecimalMin(value = "0.1")
    @DecimalMax(value = "99.9")
    private Double value;

    @Range(min = 1, max = 99, message = "范围1到99")
    @NotNull
    private Long range;

    @Email(message = "邮箱格式错误")
    private String email;

    @Size(min = 20, max = 30, message = "字符串长度在20到30之间")
    private String size;
}
